import { createSlice } from '@reduxjs/toolkit';

const customerMessageSlice = createSlice({
	name: 'customerMessage',
	initialState: {},
	reducers: {
		setCustomerMessage(state, action) {
			return action.payload;
		},
		clearCustomerMessage(): any {
			return {};
		}
	}
});

const customerMessageListSlice = createSlice({
	name: 'customerMessageList',
	initialState: [],
	reducers: {
		setCustomerMessageList(state: any, action): any {
			return [...state, ...action.payload];
		},
		clearCustomerMessage(): any {
			return [];
		}
	}
});

export const { setCustomerMessage } = customerMessageSlice.actions;
export const { setCustomerMessageList } = customerMessageListSlice.actions;
const customerMessage = customerMessageSlice.reducer;
const customerMessageList = customerMessageListSlice.reducer;
export { customerMessage, customerMessageList };
